<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<%@include file="../common/selfCss.jsp"%>

<script type="text/javascript">
<!--

	$(function() {
		
		$("#parent").ligerComboBox({
			width : 215,
			selectBoxWidth : 215,
			selectBoxHeight : 180,
			valueField : 'id',
			textField : 'text',
			treeLeafOnly : false,
			tree : {
				checkbox : false,
				btnClickToToggleOnly : false,
				url : '/misc/artPic/classTree.htm?type=${type}'
			}
		});
		if("${parentId}" != "undefined"){
			$("#parent_val").val("${parentId}");
		}
		
	});

	//添加新频道
	function addClass() {
		var name = $.trim($("#name").val());
		var parent = $("#parent").ligerGetComboBoxManager().getValue();
		if(parent==""){
			$.ligerDialog.warn("请选择上级频道！");
			return;
		}else if(name==""){
			$.ligerDialog.warn("请填写频道名称！");
			return;
		}
		$("#addClass").attr("onclick","");
		$.post("/misc/artPic/cmsSaveClass.htm",{
			type: $("#type").val(),
			name : name,
			parent : parent
		},function(data){
			if (data == "success") {
				//$("#name").val("");
				alert("添加成功！");
			}else{
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
			$("#addClass").attr("onclick","addClass()");
		});
	}
	//设置为根目录
	function setRootParent(){
		$('#parent').val('一级目录');
		$('#parent_val').val('0');
	}
//-->
</script>

<style>
	.def_t td{border:1px solid #ccc; padding:5px;}
	
</style>
<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<c:if test="${type eq '001' }">展览馆</c:if>
<c:if test="${type eq '002' }">定制</c:if>
<c:if test="${type eq '003' }">拍卖</c:if>
<c:if test="${type eq '004' }">创意领域</c:if>
<c:if test="${type eq '005' }">热门分类</c:if>
<c:if test="${type eq '006' }">专业分类</c:if>
<br>
<br>
<table width="90%">
	<tr>
		<td>名称：<input type="hidden" value="${type}" id="type"/></td>
		<td><input type="text" id="name" style="border:1px solid #a3c0e8; padding:3px 5px;width: 350px;">
		</td>
	</tr>
	<tr height="30">
		<td>频道：</td>
		<td>
			<input type="text" id="parent"/><button onclick="setRootParent()">添加一级目录</button>
		</td>
	</tr>
	<tr>
		<td colspan="2" align="center">
			<button type="button" style="padding:2px 20px;" id="addClass" onclick="addClass()">保存</button>
		</td>
	</tr>
</table>


